{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>问答详情</h5>
                    <div class="ibox-tools">
                        <a class="collapse-link">
                            <i class="fa fa-chevron-up"></i>
                        </a>
                    </div>
                </div>
                <div class="ibox-content">
                    <form class="form-horizontal m-t" name="add_article" id="add_article" enctype="multipart/form-data">
                        <input type="hidden" name="id" value="{$list['answer_id']}">
                        <div class="form-group">
                            <label class="col-sm-3 control-label yanse">回答图片：</label>
                            <div class="input-group col-sm-7">
                                <div class="page-container">
                                    <input type="hidden" name="del" id="del" value="">
                                    <input type="hidden" id="hid" value="{$list['answer_img']}">
                                    <input type="hidden" name="photo" id="photo" value="{$list['answer_img']}">
                                    <div id="uploader" class="wu-example">
                                        <div class="queueList">
                                            <div id="dndArea" class="placeholder">
                                                <div id="filePicker"></div>
                                                <p>或将照片拖到这里,支持JPG,JPEG,PNG,BMP,GIF</p >
                                            </div>
                                        </div>
                                        <div class="statusBar" style="display:none;">
                                            <div class="progress progress-striped active">
                                                <div class="progress-bar progress-bar-success">
                                                    <span>0%</span>
                                                </div>
                                            </div>
                                            <div class="info"></div>
                                            <div class="btns">
                                                <div id="filePicker2"></div>
                                                <div class="uploadBtn">开始上传</div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <span class="help-block m-b-none photos" ><i class="fa fa-info-circle"></i> 必填</span>
                                <a id="myPhoto"  class="photos" style="color:#A94543"></a>
                            </div>
                        </div>
                        <div class="form-group" id="MyContent">
                            <label class="col-sm-3 control-label cyanse" for="myEditor">内容：</label>
                            <div class="input-group col-sm-9">
                                <textarea  name="answer_content" style="width:55%;height:200px" id="myEditor"><?php echo(html_entity_decode($list['answer_content']?$list['answer_content']:''))?></textarea>
                                <a id="myEditors" style="color:#A94543"></a>
                            </div>
                        </div>


                        <div class="form-group">
                            <div class="col-sm-4 col-sm-offset-3">
                                <button class="btn btn-primary btsave"  type="button"><i class="fa fa-save"></i> 保存</button>&nbsp;&nbsp;&nbsp;
                                <a class="btn btn-danger" href="javascript:history.go(-1);"><i class="fa fa-close"></i> 返回</a>
                            </div>
                        </div>
                    </form>
                </div>
            </div>

        </div>
    </div>
</div>
{include file="public/footer" /}
<script type="text/javascript" src="__JS__/webupload/webuploader_update.js"></script>
<script>
    $(".btsave").on('click',function () {
        var formData = new FormData($("#add_article" )[0]);
        var content = $.trim($("#myEditor").val());
        if(content>200){
            layer.msg("回答内容不能超过200个字节", {icon: 1, time: 1500, shade: 0.1}, function (index) {
            });
            return false;
        }
        $.ajax({
            url: "{:url('update')}",
            type: "post",
            dataType: "json",
            async: false,//1，这四个要写上，否则点击没反应
            cache: false,//2
            contentType: false,//3
            processData: false,//4
            data: formData,
            success: function (data) {
                if (data.code == 200) {
                    wk.success(data.msg,1,"{:url('interlocution/index')}");
                } else if(data.code==100){
                    $('.btn').removeAttr('disabled');
                    wk.error(data.msg,2,'');
                    return false;
                }
            }
        });
    })
</script>
</body>
</html>